﻿using RimWorld;
using Verse;

namespace ARMIR {
    /// <summary>
    /// 能力-如你所愿，使用后通过给予使用者hediff来启用技能
    /// </summary>
    public class CompAbilityEffect_AsYourwish : CompAbilityEffect {
        private Pawn Pawn => parent.pawn;

        public new CompProperties_AsYourwish Props => (CompProperties_AsYourwish)props;

        public override bool AICanTargetNow(LocalTargetInfo target) {
            if (Pawn.Faction == Faction.OfPlayer) {
                return false;
            }

            return true;
        }

        public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) {
            if (target.Pawn != null && Props.hediffAYW != null) {
                Hediff asYourWish = HediffMaker.MakeHediff(Props.hediffAYW, Pawn);
                Pawn.health.AddHediff(asYourWish);
            }
        }
    }
}